import java.sql.*;
import java.util.Properties;

public class Main {
    public static void main(String[] args) throws Exception {
        Main xxx=new Main();
        xxx.process("16");
        xxx.process("17");
        xxx.process("18");
        xxx.process("19");
    }
    void process(String mode) throws Exception {
        Connection connection=getFuckConn();
        ResultSet idSet=getAllId(connection);

        ProcessOn2019 n1=new ProcessOn2019();
        while (idSet.next()){
            String id=idSet.getString(1);
            int done=idSet.getInt(2);
            if(done==1||!id.substring(0,mode.length()).equals(mode))continue;//已运算or学号不符合模式

            MySet s1=n1.process(id);
            s1.FBI(connection);
            s1.test(connection);
        }
    }

    private static ResultSet getAllId(Connection connection) throws Exception{
        String sql = "SELECT stu_id,is_done from ecard2020.fuckndzd_test2";
        PreparedStatement PSN = connection.prepareStatement(sql);
        return PSN.executeQuery();
    }
    static Connection getFuckConn() throws ClassNotFoundException, SQLException {
        String driver = "com.mysql.jdbc.Driver";
        String url;
        url= "jdbc:mysql://127.0.0.1:3306/ecard2020?useSSL=false&allowMultiQueries=true&serverTimezone=UTC";
        Properties props = new Properties();
        props.put("user", "root");
        props.put("password", "root");

        Class.forName(driver);
        return DriverManager.getConnection(url,props);
    }
}
